#include "client.h"

Client::Client()
{
    _status = UNREADY;
    _sock.set_handle(0);
}

Client::Client(ACE_HANDLE handle)
{
    _status = UNREADY;
    _sock.set_handle(handle);
}

Client::Client(const ACE_SOCK_Stream &ass)
{
    _sock = ass;
    _status = UNREADY;
}

bool Client::operator==(const Client &cient) const
{
    return this->getSOCK().get_handle() == cient.getSOCK().get_handle();
}

bool Client::operator!=(const Client &client) const
{
    return !(*this == client);
}

bool Client::setReady(bool ready)
{
    if((ready && _status == READY) || (!ready && _status == UNREADY))
        return false;

    _status = (ready ? READY : UNREADY);
    return true;
}
